package cn.sdfykjyxgs.synclient.controller;

import cn.sdfykjyxgs.synclient.base.HttpResult;
import cn.sdfykjyxgs.synclient.entity.FileSynConfig;
import cn.sdfykjyxgs.synclient.server.FileServer;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Controller
@ResponseBody
public class FileController {

    @Resource
    FileServer fileServer;

    @PostMapping("/fileIsOnline")
    public HttpResult fileIsOnline(@RequestBody FileSynConfig fileSynConfig) {
        HttpResult httpResult = fileServer.serverIsOnline( fileSynConfig);
        return httpResult;
    }
    @GetMapping("/synFile")
    public HttpResult synFile(@RequestParam(value = "fileId") Long fileId) {
        HttpResult httpResult = fileServer.synFile(fileId);
        return httpResult;
    }
}
